import { request} from '@/utils/request.util';
import type { Response, Res } from '@/types/common';
import type {ExecForm,ExecTable,ExecTableInfo,getExecDetailResponse,getRecordListResponse,ChargeListResponse} from '@/types/exec'

//执行：获取执行单列表
export const getExecList =  (body:ExecForm) => request.get<ExecTable> ("/order/exec/getExecList", {
  params: body
});  

//执行：获取执行单详情

export const getExecDetail = (orderId:number) => request.get<getExecDetailResponse> ("/order/exec/getExecDetail", {
  params: {
    orderId
  }
});


//执行：获取执行历史记录
export const getRecordList =  (body:ExecForm) => request.get<getRecordListResponse> ("/order/exec/getRecordList", {
  params: body
});  


//添加执行
export const addExecRecord = (body:{
  orderId:number,
  groupName?:string,
  execResult?:any,
}) => request.post<Response<Res>>("/order/exec/addExecRecord",body);

//房发药：发药单审核
export const rejectDelivery = (body:{
  orderId:number,
  deliveryStatus:string,
  refuseReason?:string,
}) => request.post<Response<Res>>("/order/dispense/rejectDelivery",body);



export const addInfusionFee = (body:{
  orderId:number,
  amount:any,
}) => request.post<Response<Res>>("/order/exec/addInfusionFee",body);

//获取收费列表
export const getChargeList =  (orderId:any) => request.get<ChargeListResponse> ("/order/exec/getChargeList?orderId="+orderId,{});  


//编辑执行记录
export const updateExecRecord = (body:{
  recordId:number,
  execResult?:any,
}) => request.post<Response<Res>>("/order/exec/updateExecRecord",body);

